Optimal. Leaf size=90 \[ -\frac {b^2 \tanh ^{-1}\left (\frac {\cos (c+d x) (b-a \tan (c+d x))}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2} d}+\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \sin (c+d x)}{\left (a^2+b^2\right ) d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 90, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3592, 3567,
2717, 3590, 212} \begin {gather*} \frac {a \sin (c+d x)}{d \left (a^2+b^2\right )}+\frac {b \cos (c+d x)}{d \left (a^2+b^2\right )}-\frac {b^2 \tanh ^{-1}\left (\frac {\cos (c+d x) (b-a \tan (c+d x))}{\sqrt {a^2+b^2}}\right )}{d \left (a^2+b^2\right )^{3/2}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 2717
Rule 3567
Rule 3590
Rule 3592
Rubi steps
\begin {align*} \int \frac {\cos (c+d x)}{a+b \tan (c+d x)} \, dx &=\frac {\int \cos (c+d x) (a-b \tan (c+d x)) \, dx}{a^2+b^2}+\frac {b^2 \int \frac {\sec (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \int \cos (c+d x) \, dx}{a^2+b^2}-\frac {b^2 \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,\cos (c+d x) (b-a \tan (c+d x))\right )}{\left (a^2+b^2\right ) d}\\ &=-\frac {b^2 \tanh ^{-1}\left (\frac {\cos (c+d x) (b-a \tan (c+d x))}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{3/2} d}+\frac {b \cos (c+d x)}{\left (a^2+b^2\right ) d}+\frac {a \sin (c+d x)}{\left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.35, size = 79, normalized size = 0.88 \begin {gather*} \frac {2 b^2 \tanh ^{-1}\left (\frac {-b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2+b^2}}\right )+\sqrt {a^2+b^2} (b \cos (c+d x)+a \sin (c+d x))}{\left (a^2+b^2\right )^{3/2} d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.40, size = 90, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {\frac {2 b^{2} \arctanh \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}-\frac {2 \left (-a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-b \right )}{\left (a^{2}+b^{2}\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}}{d}\) | \(90\) |
default | \(\frac {\frac {2 b^{2} \arctanh \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}-\frac {2 \left (-a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-b \right )}{\left (a^{2}+b^{2}\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}}{d}\) | \(90\) |
risch | \(-\frac {i {\mathrm e}^{i \left (d x +c \right )}}{2 \left (-i b +a \right ) d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{2 \left (i b +a \right ) d}+\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{3}+i a \,b^{2}-a^{2} b -b^{3}}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}} d}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{3}+i a \,b^{2}-a^{2} b -b^{3}}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}} d}\) | \(174\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 142, normalized size = 1.58 \begin {gather*} -\frac {\frac {b^{2} \log \left (\frac {b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (b + \frac {a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}}{a^{2} + b^{2} + \frac {{\left (a^{2} + b^{2}\right )} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 187 vs.
\(2 (88) = 176\).
time = 0.40, size = 187, normalized size = 2.08 \begin {gather*} \frac {\sqrt {a^{2} + b^{2}} b^{2} \log \left (-\frac {2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) - a \sin \left (d x + c\right )\right )}}{2 \, a b \cos \left (d x + c\right ) \sin \left (d x + c\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right ) + 2 \, {\left (a^{2} b + b^{3}\right )} \cos \left (d x + c\right ) + 2 \, {\left (a^{3} + a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cos {\left (c + d x \right )}}{a + b \tan {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.54, size = 118, normalized size = 1.31 \begin {gather*} -\frac {\frac {b^{2} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{{\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} - \frac {2 \, {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b\right )}}{{\left (a^{2} + b^{2}\right )} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.84, size = 110, normalized size = 1.22 \begin {gather*} \frac {\frac {2\,b}{a^2+b^2}+\frac {2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a^2+b^2}}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {2\,b^2\,\mathrm {atanh}\left (\frac {a^2\,b+b^3-a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^2+b^2\right )}{{\left (a^2+b^2\right )}^{3/2}}\right )}{d\,{\left (a^2+b^2\right )}^{3/2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________